package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {


    /**
     * 根据id列表查询套餐是否包含餐品
     * @param ids
     * @return
     */
    List<SetmealDish> getByIds(List<Long> ids);

    /**
     * 新增套餐菜品信息
     * @param setmealDishes
     */
    void addSetmealDish(List<SetmealDish> setmealDishes);

    /**
     * 根据套餐id查询关联菜品信息
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{id}")
    List<SetmealDish> getBySetmealId(Long id);

    @Delete("delete from setmeal_dish where setmeal_id = #{id}")
    void deletebyId(Long setmealId);

    /**
     * 根据套餐id批量删除关联的菜品信息
     * @param ids
     */
    void deleteByIds(List<Long> ids);

    /**
     * 根据套餐id查询菜品id列表
     * @param id
     * @return
     */
    @Select("select dish_id from setmeal_dish where setmeal_id = #{id}")
    List<Long> getDishIdById(Long id);
}
